package dao

import (
	"gitee.com/mangenotwork/game-douniu/api/common"
	"gitee.com/mangenotwork/game-douniu/api/entity"
	"github.com/mangenotwork/common/log"
)

type AdminDao struct {
}

func (dao *AdminDao) Login(user, password string) bool {
	db := common.GetGorm("test")
	data := &entity.Admin{}
	err := db.Model(&entity.Admin{}).Where("user=? and password=?", user, password).Find(&data).Error
	if err != nil {
		log.Error(err)
		return false
	}
	if data.AdminId > 0 {
		return true
	}
	return false
}
